widget: Propagate PRELIGHT state when unsetting it
authorTimm Bäder <mail@baedert.org>
Tue, 29 Jan 2019 06:17:46 +0000 (07:17 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 29 Jan 2019 06:19:54 +0000 (07:19 +0100)
Without this, disabling a widget that's being hovered and is a child
widget of the widget we're disabling (e.g. the GtkImage child of a
GtkButton) will retain its :hover state even though it should be
insensitive to any sort of input now.

gtk/gtkwidget.c

index 67c1d6db5034843ca753549da8298a7bcd4cbab5..d6d0189c87d0e773cee4f3d150c68161b0622d7a 100644 (file)
  * ]|
  */
 
-#define GTK_STATE_FLAGS_DO_PROPAGATE (GTK_STATE_FLAG_INSENSITIVE|GTK_STATE_FLAG_BACKDROP)
+#define GTK_STATE_FLAGS_DO_SET_PROPAGATE   (GTK_STATE_FLAG_INSENSITIVE | \
+                                            GTK_STATE_FLAG_BACKDROP)
+#define GTK_STATE_FLAGS_DO_UNSET_PROPAGATE (GTK_STATE_FLAG_INSENSITIVE | \
+                                            GTK_STATE_FLAG_BACKDROP | \
+                                            GTK_STATE_FLAG_PRELIGHT)
 
 typedef struct {
   gchar               *name;           /* Name of the template automatic child */
@@ -6551,7 +6555,7 @@ gtk_widget_reposition_after (GtkWidget *widget,
 
   /* Merge both old state and current parent state,
    * making sure to only propagate the right states */
-  data.flags_to_set = parent_flags & GTK_STATE_FLAGS_DO_PROPAGATE;
+  data.flags_to_set = parent_flags & GTK_STATE_FLAGS_DO_SET_PROPAGATE;
   data.flags_to_unset = 0;
   gtk_widget_propagate_state (widget, &data);
 
@@ -8985,8 +8989,8 @@ gtk_widget_propagate_state (GtkWidget          *widget,
 
       /* Make sure to only propagate the right states further */
       child_data.old_scale_factor = new_scale_factor;
-      child_data.flags_to_set = data->flags_to_set & GTK_STATE_FLAGS_DO_PROPAGATE;
-      child_data.flags_to_unset = data->flags_to_unset & GTK_STATE_FLAGS_DO_PROPAGATE;
+      child_data.flags_to_set = data->flags_to_set & GTK_STATE_FLAGS_DO_SET_PROPAGATE;
+      child_data.flags_to_unset = data->flags_to_unset & GTK_STATE_FLAGS_DO_UNSET_PROPAGATE;
 
       if (child_data.flags_to_set != 0 ||
           child_data.flags_to_unset != 0)